import { View } from "../../../../mvc/core/View";
import { UiHintIconView } from "../../uiIconBtn/UiHintIconView";
import { ECopyType } from "../../../../../Message/Public/ECopyType";
import { TCopy } from "../../../../../Message/Db/Tables/TCopy";
import { Cache } from "../../../cache/Cache";
import { SGuildStruggleInfo } from "../../../../../Message/Public/SGuildStruggleInfo";
import { ExpAddEffectInfo } from "../../../resource/info/ExpAddEffectInfo";
import { AttributeTextType } from "../../../scene/player/type/AttributeTextType";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { SGuildStruggleProcess } from "../../../../../Message/Public/SGuildStruggleProcess";
import { OpenGuildCopyWindow } from "./OpenGuildCopyWindow";
import { GuildCopyInfoPanel } from "./GuildCopyInfoPanel";
import { BaseHintIcon } from "../../common/hintIcon/BaseHintIcon";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GirlEnterSecondFloor } from "./GirlEnterSecondFloor";
type int = number;
//class GuildCopyView
    
    export  class GuildCopyView extends View
    {
        constructor()
        {
            super();
            return;
        }

        public showOpenCopyWin(arg1: int=-1): void
        {
            this.openCopyWin.show();
            this.openCopyWin.showToEntrance(arg1);
            return;
        }

        public updateOpenWinStatus(): void
        {
            if (this._openCopyWin && !this._openCopyWin.isHide) 
            {
                this._openCopyWin.updateStatus();
            }
            return;
        }

        public hideOpenCopyWin(): void
        {
            if (this._openCopyWin && !this._openCopyWin.isHide) 
            {
                this._openCopyWin.hide();
            }
            return;
        }

        public showOpenHintIcon(): void
        {
            UiHintIconView.instance.addHintIcon(this.openHintIcon);
            return;
        }

        public hideOpenHintIcon(): void
        {
            if (this._openHintIcon && this._openHintIcon.parent) 
            {
                UiHintIconView.instance.removeHintIcon(this.openHintIcon);
            }
            return;
        }

        /* internal  */onHintIconClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.showOpenCopyWin(ECopyType._ECopyGuildStruggle);
            return;
        }

        public showGuildCopyInfo(arg1: TCopy): void
        {
            this.infoPanel.show();
            this.infoPanel.title = arg1.name;
            var loc1=Cache.instance.copy.guildStruggleInfo;
            this.updateCopyInfo(loc1);
            var loc2=Cache.instance.copy.guildStruggleProcess;
            this.updateProcess(loc2);
            return;
        }

        public hideGuildCopyInfo(): void
        {
            if (this._infoPanel) 
            {
                this.infoPanel.clean();
                this.infoPanel.hide();
            }
            return;
        }

        public updateCopyInfo(arg1: SGuildStruggleInfo): void
        {
            if (this._infoPanel && !this._infoPanel.isHide) 
            {
                this.infoPanel.updateStruggleInfo(arg1);
            }
            return;
        }

        public updateExp(arg1: int): void
        {
            if (this._infoPanel && !this._infoPanel.isHide) 
            {
                this.infoPanel.updateExp();
            }
            return;
        }

        public updateContribute(arg1: int): void
        {
            var loc1=null;
            var loc2=null;
            if (this._infoPanel && !this._infoPanel.isHide) 
            {
                this.infoPanel.updateContribute();
                loc1 = this.infoPanel.getContributePoint();
                loc2 = new ExpAddEffectInfo(0, 0, loc1.x, loc1.y, arg1, 2, AttributeTextType.contribution);
                Dispatcher.dispatchEvent(new DataEvent(EventName.ShowAddExpEffectByInfo, loc2));
            }
            return;
        }

        public updateProcess(arg1: SGuildStruggleProcess): void
        {
            if (this._infoPanel && !this._infoPanel.isHide) 
            {
                this.infoPanel.updateProcessInfo(arg1);
            }
            return;
        }

        public showGirlEnterSecondFloor(): void
        {
            this.girlEnterSecondFloor.show();
            return;
        }

        public stageResize(): void
        {
            if (this._infoPanel) 
            {
                this._infoPanel.updatePosition();
            }
            return;
        }

        public get openCopyWin(): OpenGuildCopyWindow
        {
            if (!this._openCopyWin) 
            {
                this._openCopyWin = new OpenGuildCopyWindow();
            }
            return this._openCopyWin;
        }

        public get infoPanel(): GuildCopyInfoPanel
        {
            if (!this._infoPanel) 
            {
                this._infoPanel = new GuildCopyInfoPanel();
            }
            return this._infoPanel;
        }

        public get openHintIcon(): BaseHintIcon
        {
            if (!this._openHintIcon) 
            {
                this._openHintIcon = new BaseHintIcon(ImagesConst.copyHintIcon);
                this._openHintIcon.addEventListener(flash.events.MouseEvent.CLICK, this.onHintIconClick);
            }
            return this._openHintIcon;
        }

        public get girlEnterSecondFloor(): GirlEnterSecondFloor
        {
            if (!this._girlEnterSecondFloor) 
            {
                this._girlEnterSecondFloor = new GirlEnterSecondFloor();
            }
            return this._girlEnterSecondFloor;
        }

        /* internal */ /* var */_openCopyWin: OpenGuildCopyWindow;

        /* internal */ /* var */_infoPanel: GuildCopyInfoPanel;

        /* internal */ /* var */_girlEnterSecondFloor: GirlEnterSecondFloor;

        /* internal */ /* var */_openHintIcon: BaseHintIcon;
    }
